#pragma once

#include "kiva/node.h"
#include "pyast11/pyast11.h"

namespace kiva {

class Parser {
 public:
  using Operator = pyast11::operator_;
  using UnaryOperator = pyast11::unaryop;
  using BoolOperator = pyast11::boolop;
  using CompareOperator = pyast11::cmpop;
  using StatementList = pyast11::stmt_list;
  using ExpressionList = pyast11::expr_list;
  using Expression = pyast11::expr;
  using Statement = pyast11::stmt;

  static Operator ToOperator(NodeType type);
  static UnaryOperator ToUnaryOperator(NodeType type);
  static BoolOperator ToBoolOperator(NodeType type);
  static CompareOperator ToCompareOperator(NodeType type);

  static std::unique_ptr<Parser> New();
  virtual Expression ParseExpr(NodeRef node) = 0;
  virtual StatementList ParseStatementList(NodeRef node) = 0;
  virtual ~Parser() {}
};

}  // namespace kiva
